<template>
  <p>姓名：{{ state.name }}</p>
  <p>年龄：{{ state.age }}</p>
  <button @click="state.age++">过了一年</button>
  <button @click="increment">过了十年</button>
</template>

<script>
import { reactive } from 'vue';

export default {
  name: 'App',
  setup() {
    const state = reactive({ name: '张三', age: 18 });
    const increment = () => {
      state.age += 10;
    };
    return { state, increment };
  },
};
</script>
